package game.frame;

import com.lovo.netCRM.component.LovoButton;
import com.sun.tools.javac.Main;
import game.roles.visual.BackgroundMaps;
import game.utils.FileUtils;

import javax.swing.*;
import java.awt.*;

/**
 * @author liuyulai
 * Created with IntelliJ IDEA.
 * Date: 21.5.12
 * Time: 13:36
 * Description: 成功界面
 */
public class SuccessFrame extends JFrame {

    private LovoButton lb = new LovoButton("返回主菜单", 140, 200, this);

    private LovoButton lb2 = new LovoButton("查看排行榜", 140, 230, this);

    public SuccessFrame() {
        JLabel jlImg = new JLabel();
        Image img = new ImageIcon("img/success.png").getImage();
        img = img.getScaledInstance(400, 400, 1);
        jlImg.setIcon(new ImageIcon(img));
        this.add(jlImg);
        this.setSize(400, 400);
        this.setVisible(true);
        this.setLayout(null);
        init();
        this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        this.setLocationRelativeTo(null);
    }

    private void init() {
        lb.addActionListener(e -> {
            MainFrame.frameInitData();
            this.dispose();
            new StartFrame();
        });

        lb2.addActionListener(e -> {
            FileUtils.readPlayerList();
            new Leaderboard();
        });
    }

//    public static void main(String[] args) {
//        MainFrame.playerExp=100000;
//        FileUtils.init();
//        new SuccessFrame();
//    }

}
